﻿using System.ComponentModel;
using SpectrumAnalyser.ModelObjects;
using SpectrumAnalyser.ModelObjects.Enum;
using SpectrumAnalyser.Shell.PropertyGrid.Editors;

namespace SpectrumAnalyser.Shell.ViewModels
{
    public class ZaidelSpectrumDbConnectionViewModel : SpectrumDbConnectionViewModel
    {
        public ZaidelSpectrumDbConnectionViewModel(SpectrumDbConnection dbConnection) : base(dbConnection)
        {
        }

        [Editor(typeof (FilepathEditor), typeof (FilepathEditor))]
        public override string ConnectionString { get; set; }

        public ZaidelSpectrumDbConnection ToOutSpectrumDbConnection()
        {
            return new ZaidelSpectrumDbConnection
                       {ConnectionName = this.ConnectionName, ConnectionString = ConnectionString, IsUsed = IsUsed};
        }

        #region Overrides of SpectrumDbConnectionViewModel

        /*public override ConnectionType ConnectionType
        {
            get { return ConnectionType.Zaidel; }
        }

        public override SpectrumDbConnection ToSpectrumDbConnection()
        {
            return ToOutSpectrumDbConnection();
        }

        public override SpectrumDbConnectionViewModel FromSpectrumDbConnection(SpectrumDbConnection connection)
        {
            return new ZaidelSpectrumDbConnectionViewModel
                       {
                           ConnectionName = connection.ConnectionName,
                           ConnectionString = connection.ConnectionString,
                           IsUsed = connection.IsUsed
                       };
        }
        */
        #endregion
    }
}